<?php
/**
 * Session
 * @TODO session_set_cookie_params，session的ini操作
 *
 * @package SF
 * @author Shuky
 * @since v1.0
 * @version $Id: Exception.php 82 2010-12-23 18:23:35Z shukyoo@gmail.com $
 */
namespace SF\Session;

class Session
{
	/**
	 * Session赋值
	 */
	public static function set($key, $value)
	{
		$_SESSION[$key] = $value;
	}

	/**
	 * Session获取
	 */
	public static function get($key, $default = null)
	{
		return isset($_SESSION[$key]) ? $_SESSION[$key] : $default;
	}

	/**
	 * 获取session id
	 */
	public static function getSessionId()
	{
		return session_id();
	}

	/**
	 * 关闭Session
	 */
	public static function close()
	{
		session_write_close();
	}

	/**
	 * 注销Session
	 */
	public static function destroy($key = null)
	{
		if ($key) {
			unset($_SESSION[$key]);
		} else {
			session_unset();
			session_destroy();
		}
	}
}